package org.ljy.testdemo;

import org.ljy.testdemo.controller.TestController;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
public class TestDemoApplication {

    public static void main(String[] args) {
        ApplicationContext context = SpringApplication.run(TestDemoApplication.class, args);//获取Spring容器

        TestController testController = context.getBean(TestController.class);
        testController.t2();


        TestController testController2 = (TestController) context.getBean("testController");
        testController2.t2();

        TestController testController3 = context.getBean("testController", TestController.class);
        testController3.t2();

    }

}